/**
 * Created by jiaxing on 2017/11/16.
 */
$(function () {
    var lis = $(".menu").children();
    console.log(lis);
    lis.click(function () {
        //console.log($(this).attr("data_name"));
        var current = $(this).attr("data_name");
        $(".content ul li").css("display","none");
        $("."+current).css("display","block");
    })
    $(".input_txt").focus(function () {
        $(this).attr("value","");
    })
})

 var obj = {
            url:"/shixun/tea?id="+sessionStorage.getItem("username"),
            dataType:"json",
            type:"get",
            success:function(data){
                var Data = data[0];
                console.log(Data);

                $("#Student11_StudentNo").val(Data.id);
                $("#Student11_StudentName").val(Data.name);
                $("#Student11_NamePY").val(Data.nameletter);
                // $("#Student11_StudentNo").val(Data.id);
                $("#Student11_BirthDay").val(Data.birthday);
                // $("#Student11_StudentNo").val(Data.id);
                $("#Student11_GuideTeacher").val(Data.salary);
                // $("#Student11_StudentNo").val(Data.id);
                $("#Student11_NativePlace").val(Data.placeoforgin);
                $("#Student21_IdCard").val(Data.idcard);
                // $("#Student11_StudentNo").val(Data.id);
                $("#Student21_DoctorNo").val(Data.med_card);
                // $("#Student11_StudentNo").val(Data.id);
                $("#Student21_BankNo").val(Data.bankid);
                // $("#Student11_StudentNo").val(Data.id);
                // $("#Student11_StudentNo").val(Data.id);
                // $("#Student11_StudentNo").val(Data.id);
                $("#Student21_hobby").val(Data.hobby);
                $("#Student21_Strengths").val(Data.specialty);
                $("#Student21_FamillyCount").val(Data.family);
            },
            error:function(e){
                console.log(e);
            }
        }
        $.ajax(obj);


    //侧边栏点击事件
    var lis = $(".menu").children();
    console.log(lis);
    lis.click(function () {
        //console.log($(this).attr("data_name"));
        var current = $(this).attr("data_name");
        $(".content ul li").css("display","none");
        $("."+current).css("display","block");

        //ajax请求

        //学生信息
        if(current == "content_info"){
            var obj = {
                url:"/shixun/tea?id="+sessionStorage.getItem("username"),
                dataType:"json",
                type:"get",
                success:function(data){
                    var Data = data[0];
                    console.log(Data);
                },
                error:function(e){
                    console.log(e);
                }
            }
            $.ajax(obj);
        }
        //课表
        else if(current == "content_schedule")
        {
            var obj = {
                url:"/shixun/stu2?id="+sessionStorage.getItem("username"),
                dataType:"json",
                type:"get",
                success:function(data){

                },
                error:function(e){
                    console.log(e);
                }
            }
            $.ajax(obj);
        }
        //成绩单
        else if(current == "content_report"){
            var obj = {
                url:"/shixun/stu3?id="+sessionStorage.getItem("username"),
                dataType:"json",
                type:"get",
                success:function(data){

                },
                error:function(e){
                    console.log(e);
                }
            }
            $.ajax(obj);
        }

    })
    $(".input_txt").focus(function () {
        $(this).attr("value","");
    })


})